<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="com.lp.cfg.ProConfig"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/WEB-INF/oss/iot/common/variable.jsp"%>
<%@ include file="/WEB-INF/oss/iot/common/variable_js.jsp"%>
<%@ include file="/WEB-INF/oss/iot/common/resource_lib.jsp"%>
<style type="text/css">
	.app-container{
		background:  #f2f2f2;width: 100%;border-top:1px solid #ecf0f5;
	}
	.box {
	    padding: 10px;
	    position: relative;
	    border-radius: 3px;
	    background: #fff;
	    margin-bottom: 20px;
	    width: 100%;
	    box-shadow: 0 1px 1px rgba(0,0,0,.1);
	    border: 0!important;
	    box-shadow: 0 0 2px 1px rgba(13,5,9,.08)!important;
	}
	.sceneList-info{
		padding-top: 10px;
		padding-left: 10px;
	}
</style>
</head>
<body>
	<div>
		<div style="background: #ecf0f5;">
			<div class="mapContainer" >
				<div class="app-container">
					<div class="container-layout sceneList-info">
						<div class="box join-device-box">
							<div>
								<div class="search-container jui-search_table" data-options=" submit:'#searchbtns',
																					 table:'#init-table' ">
										<span>设备种类名称：</span> 
										<input type-name="name" placeholder="名称 查询"  class="input input-self" />
										<button onclick="addInfo();" class="button ml-20 bg-iot float-right"><span class="icon-plus"></span> 新增种类</button>
										<button id="searchbtns" class="button ml-20 bg-iot float-right"><span class="icon-search"></span> 查询</button>
								</div>
								
								 <div>
									<div id="init-table" type-option="table" config-option=" url:'/device/page/category',
												 param:{},
												 columns:[
													{'name':'序号','type':'seq','value':'seq','width':'6%'}, 
													{'name':'种类名称','value':'name','width':'10%'}, 
													{'name':'备注','value':'remark','width':'10%', limit:15},
													{'name':'排序','value':'seq','width':'6%'},
													{ name:'操作', type:'self', value_callback :'value_function','width':'5%'}]" > 
									</div>
								</div> 
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript">

function value_function(data,seq){
	return "<span tag='编辑' onclick='t_edit(this,"+data.id+")' class='self-icon icon-edit'></span>"+
	       "<span tag='删除' onclick='t_delete(this,"+data.id+")' class='self-icon icon-bitbucket'></span>"
		  ;
}
	
function addInfo(){
	layer.open({
	      type: 2,
	      title: '新增信息',
	      shadeClose: true,
	      shade: 0.7,
	      maxmin: true, //开启最大化最小化按钮
	      area: ['700px', '490px'],
	      content: "<%=basePath%>/service/qpro/device_category_detail"
	   });
}

function t_edit(obj,id){
	layer.open({
	      type: 2,
	      title: '编辑信息',
	      shadeClose: true,
	      shade: 0.7,
	      maxmin: true, //开启最大化最小化按钮
	      area: ['700px', '490px'],
	      content: "<%=basePath%>/service/qpro/device_category_detail?id="+id
	 });
}

function t_delete(obj,id){
	lcomfirm('是否确定删除？',function(){
		commonAjax("DELETE",localUrl+"/device/category?id="+id, "",function(){
			tip("删除成功");
			setTimeout(function(){
				closeAll();
				$("#init-table").tableAdaptor();
			},1000)
		});
	})
}

$(function(){
	$(document).delegate(".limiter","click",function(){
		layer.tips($(this).attr("tag") , this, {
			tips: [1, '#4682B4']
		});
	})
})
</script>
</html>